package luckyweb.seagull.comm;

import org.hibernate.Session;

import luckyweb.seagull.spring.dao.TestJobsDaoImpl;
import luckyweb.seagull.util.HibernateSessionFactoryUtil;

/*
 * 启动tomcat即启动一个监听，每隔十分钟扫描一次，将新增调度或者修改调度加入任务执行队列
 */
public class JobListener extends Thread{
	public static Session session = HibernateSessionFactoryUtil.getCurrentSession();

	@Override
	public void run() {
		while(true) {
			try {
				TestJobsDaoImpl.init(session);
				Thread.sleep(10*60*1000);
				System.out.println("监听job调度。。。。。。。。。。。。。。。。。。。");
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				break;
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				break;
			}
		}
		
	}

}
